﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using Mal.Balades.Admin.Services;

namespace Mal.Balades.Admin.AdminWebService
{
    public partial class Information:IInformation
    {
        public static Information Convert(IInformation source)
        {
            Information result = new Information();
            result.InformationID = source.InformationID;
            result.InformationTypeID = source.InformationTypeID;
            result.Rank = source.Rank;
            result.Text = source.Text;
            result.VisitID = source.VisitID;

            return result;
        }

        public static ReadOnlyCollection<IInformation> Convert(IEnumerable<Information> sources)
        {
            List<IInformation> results = new List<IInformation>();

            foreach (Information item in sources)
            {
                results.Add(item);
            }

            return new ReadOnlyCollection<IInformation>( results);
        }

        public static List<Information> Convert(IEnumerable<IInformation> sources)
        {
            List<Information> results = new List<Information>();

            foreach (IInformation item in sources)
            {
                results.Add(Information.Convert(item));
            }

            return results;
        }
    }
}
